<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			#father {
				width: 100%;
				height: 800px;
				background-color: bisque;
				display: flex;
				justify-content: center;
			}

			#overflow {
				width: 600px;
				height: 100px;
				margin-top: 200px;
				overflow: hidden;

			}

			#imgdiv {
				width: 1700px;
				height: 100px;
				display: flex;
				background-color: red;
			}

			#imgdiv img {
				width: 100px;
				height: 100px;
			}
		</style>
	</head>
	<body>
		<div id="father">
			<div id="overflow">
				<div id="imgdiv" onmouseenter="moussenter()" onmouseleave="mouseleave()">
					<img src="img/1.jpeg">
					<img src="img/2.jpeg">
					<img src="img/3.jpeg">
					<img src="img/4.jpeg">
					<img src="img/5.jpeg">
					<img src="img/6.jpeg">
					<img src="img/7.jpeg">
					<img src="img/8.jpeg">
					<img src="img/9.jpeg">
					<img src="img/10.jpeg">
					<img src="img/11.jpeg">
					<img src="img/1.jpeg">
					<img src="img/2.jpeg">
					<img src="img/3.jpeg">
					<img src="img/4.jpeg">
					<img src="img/5.jpeg">
					<img src="img/6.jpeg">
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		var imgobj = document.getElementById('imgdiv')
		var marleft = 0;
		var myinterval = null;
		var myinterval2 =null;


		function dong() {

			marleft--; //你想用marginright? 告诉你，用了这个后你实现不了在限定范围类滚定的功能,就比如这一题
			imgobj.style.marginLeft = marleft + 'px';
			if (marleft == -1100) {
				marleft = 0;
			};
			if (marleft % 100 == 0) {
				clearInterval(myinterval);
				clearInterval(myinterval2);
				setTimeout(function() {
					myinterval2 = setInterval(dong, 50);
				}, 1000)
			}
		};
		onload = function() {
			myinterval = setInterval(dong,50 );
		};

		function moussenter() {
			clearInterval(myinterval2);
			clearInterval(myinterval);
		};

		function mouseleave() {
			myinterval = setInterval(dong, 50);
		}
	</script>
</html>